package cn.echoedu.weblistener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import cn.echoedu.command.ContactsListCommand;
import cn.echoedu.command.ContactsListControlCommand;
import cn.echoedu.model.AClassModel;
import cn.echoedu.model.AddFeedBackModel;
import cn.echoedu.model.AppApiModel;
import cn.echoedu.model.AuthorityModel;
import cn.echoedu.model.ClassNotifyImageModel;
import cn.echoedu.model.ClassNotifyModel;
import cn.echoedu.model.ContactsListModel;
import cn.echoedu.model.DegressModel;
import cn.echoedu.model.DepartmentModel;
import cn.echoedu.model.HomePageImageModel;
import cn.echoedu.model.ImageModel;
import cn.echoedu.model.JobAuthorityModel;
import cn.echoedu.model.JobModel;
import cn.echoedu.model.PoliticalstatusModel;
import cn.echoedu.model.ProfessionalModel;
import cn.echoedu.model.ReceiveClassNotifyModel;
import cn.echoedu.model.ReceiveSchoolNotifyModel;
import cn.echoedu.model.RequestMessageModel;
import cn.echoedu.model.SchoolCalendarModel;
import cn.echoedu.model.SchoolModel;
import cn.echoedu.model.SchoolNotifyImageModel;
import cn.echoedu.model.SchoolNotifyModel;
import cn.echoedu.model.StudentModel;
import cn.echoedu.model.TeacherModel;
import cn.echoedu.model.TelContactsModel;
import cn.echoedu.model.UserModel;
import cn.echoedu.service.BaseServletService;
import cn.echoedu.service.MainService;
import cn.echoedu.service.ReceiveService;
import cn.echoedu.service.ResponseService;
import cn.echoedu.util.L;
import cn.echoedu.util.WebContext;

public class MyServletContextListener implements ServletContextListener{
    private final String T="MyServletContextListener---------->";
	public void contextDestroyed(ServletContextEvent sce) {
		// TODO Auto-generated method stub
		L.p(T+"contextDestroyed");
	}

	public void contextInitialized(ServletContextEvent sce) {
		// TODO Auto-generated method stub
		L.p(T+"contextInitialized");
		ServletContext context=sce.getServletContext();
		context.setAttribute("MainService",new MainService());
		context.setAttribute("BaseServletService",new BaseServletService());
		context.setAttribute("ReceiveService",new ReceiveService());
		context.setAttribute("ResponseService",new ResponseService());
		context.setAttribute("AppApiModel",new AppApiModel());
		context.setAttribute("DegressModel",new DegressModel());
		context.setAttribute("ImageModel",new ImageModel());
		context.setAttribute("RequestMessageModel",new RequestMessageModel());
		context.setAttribute("TelContactsModel",new TelContactsModel());
		context.setAttribute("HomePageImageModel",new HomePageImageModel());
        context.setAttribute("UserModel",new UserModel());
        context.setAttribute("StudentModel",new StudentModel());    
	    context.setAttribute("TeacherModel",new TeacherModel());
	    context.setAttribute("AClassModel",new AClassModel());
	    context.setAttribute("PoliticalstatusModel",new PoliticalstatusModel());
	    context.setAttribute("SchoolNotifyModel",new SchoolNotifyModel());
	    context.setAttribute("JobModel",new JobModel());
	    context.setAttribute("JobAuthorityModel",new JobAuthorityModel());
	    context.setAttribute("AuthorityModel",new AuthorityModel());
	    context.setAttribute("SchoolNotifyImageModel",new SchoolNotifyImageModel());
	    context.setAttribute("ReceiveSchoolNotifyModel",new ReceiveSchoolNotifyModel());
	    context.setAttribute("ClassNotifyModel",new ClassNotifyModel());
	    context.setAttribute("ClassNotifyImageModel",new ClassNotifyImageModel());
	    context.setAttribute("ProfessionalModel",new ProfessionalModel());
	    context.setAttribute("ReceiveClassNotifyModel",
	    		new ReceiveClassNotifyModel());
	    context.setAttribute("DepartmentModel",new DepartmentModel());
	    context.setAttribute("SchoolModel",new SchoolModel());
	    context.setAttribute("AddFeedBackModel", new AddFeedBackModel());
	    context.setAttribute("SchoolCalendarModel", new SchoolCalendarModel());
	    context.setAttribute("ContactsListModel", new ContactsListModel());
	    
	    WebContext.setServletContext(context);
	 }
}
